package com.zlp.common.core.erro;

/**
 *
 * @description: 自定义异常类
 * @author: ZouLiPing
 * @contact: 请关注微信公众号“给自己一个smile”里面有详细电商项目文档
 * @date: 2019年3月29日15:18:33
 * @version V1.0
 */
public class BaseException extends RuntimeException {

    private static final long serialVersionUID = -3177085408025135330L;
    private String msg;
    private int errcode;
    private String uniqueKey;
    private Throwable exception;

    public BaseException(CodeMsg codeMsg, Throwable e) {
        super(codeMsg.getMsg(), e);
        this.errcode = codeMsg.getStatus();
        this.msg = codeMsg.getMsg();
        this.exception = e;
    }

    public BaseException(CodeMsg codeMsg) {
        this.errcode = codeMsg.getStatus();
        this.msg = codeMsg.getMsg();
    }

    public BaseException(CodeMsg codeMsg, String uniqueKey) {
        this.errcode = codeMsg.getStatus();
        this.msg = codeMsg.getMsg();
        this.uniqueKey = uniqueKey;
    }

    public String getUniqueKey() {
        return uniqueKey;
    }

    public int getErrcode() {
        return errcode;
    }

    public String getMsg() {
        return msg;
    }

    public Throwable getException() {
        return exception;
    }
}
